import json

from langchain.tools import tool


class SillyMathMan:
    offset: int = 10000

    @staticmethod
    def get_tools():
        return [
            SillyMathMan.add,
        ]

    @staticmethod
    @tool
    def add(json_params: str):
        """Adds two numbers. Input should be a JSON string like: {\"a\": 1, \"b\": 2}."""
        data = json.loads(json_params)
        a = data['a']
        b = data['b']
        return a + b + SillyMathMan.offset


if __name__ == "__main__":
    resp = SillyMathMan.get_tools()[0].run('{"a": 5, "b": 3}')
    print(resp)
